package com.clss.commandhelper.tools;

import android.os.Environment;

import java.io.File;

/**
 *
 * @author Administrator
 * @date 2017/7/7
 */

public class SdCard {
    private static final String TAG = "SdCard";

    private final static String folder = "/dxPoliceLaw"; // 根目录
    private final static String img = "/img"; // 图片目录
    private final static String video = "/video"; // 视频目录
    private final static String audio = "/audio"; // 音频目录
    private final static String download = "/download"; // 下载目录
    private final static String tmp = "/tmp"; // 临时目录
    private final static String log = "/log"; // 日志
    private final static String headfile = download + "/headfile"; //头像文件

    public static String getRootPath() {
        File file = new File(Environment.getExternalStorageDirectory().toString() + folder);
        if (!file.exists()) {
            file.mkdirs();
        }
        return Environment.getExternalStorageDirectory().toString() + folder;
    }

    public static String getImg() {
        File file = new File(getRootPath() + img);
        if (!file.exists()){
            file.mkdirs();
        }
        return getRootPath() + img;
    }

    public static String getVideo() {
        File file = new File(getRootPath() + video);
        if (!file.exists()){
            file.mkdirs();
        }
        return getRootPath() + video;
    }

    public static String getAudio() {
        File file = new File(getRootPath() + audio);
        if (!file.exists()) {
            file.mkdirs();
        }
        return getRootPath() + audio;
    }

    public static String getTmp() {
        File file = new File(getRootPath() + tmp);
        if (!file.exists()) {
            file.mkdirs();
        }
        return getRootPath() + tmp;
    }

    public static String getDownload() {
        File file = new File(getRootPath() + download);
        if (!file.exists()) {
            file.mkdirs();
        }
        return getRootPath() + download;
    }

    public static String getLog() {
        File file = new File(getRootPath() + log);
        if (!file.exists()) {
            file.mkdirs();
        }
        return getRootPath() + log;
    }

    public static String getHeadFile() {
        File file = new File(getRootPath() + headfile);
        if (!file.exists()) {
            file.mkdirs();
        }
        return getRootPath() + headfile;
    }

    public static void mkdirs() {
        Lg.i(TAG, "---mkdirs===");
        File file = new File(getRootPath());
        if (!file.exists()) {
            file.mkdirs();
            Lg.i(TAG, "---mkdirs===" + file.getPath());
        }
			/*file = new File(getImg());
			if(!file.exists())
				file.mkdirs();

			file = new File(getImg());
			if(!file.exists())
				file.mkdirs();

			file = new File(getTmp());
			if(!file.exists())
				file.mkdirs();

			file = new File(getDownload());
			if(!file.exists())
				file.mkdirs();*/
    }

}
